const Service = require('egg').Service;

class UserService extends Service {
    // 用户名是否存在
  async yz(username) {
    const { app } = this;
    return await app.mysql.query('select * from login where username = ?', [username])
  }
  //注册
  async zc(username,pwd,name,email) {
    const { app } = this;
    return await app.mysql.query('insert into login (username,pwd,name,email) values (?,?,?,?)',[username,pwd,name,email])
  }
  //登陆
  async login(username,pwd) {
    const { app } = this;
    return await app.mysql.query('select * from login where username = ? and pwd = ?',[username,pwd])
  }
}

module.exports = UserService;